Proper connect_port
[juce-lv2.git] / juce / source / extras / browser plugins / wrapper / npapi / npupp.h
blob59dd942ddfa5ed683f3fd857530ffee55832c15d
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
40 * npupp.h $Revision: 3.26 $
41 * function call mecahnics needed by platform specific glue code.
45 #ifndef _NPUPP_H_
46 #define _NPUPP_H_
48 #if defined(__OS2__)
49 #pragma pack(1)
50 #endif
52 #ifndef GENERATINGCFM
53 #define GENERATINGCFM 0
54 #endif
56 #ifndef _NPAPI_H_
57 #include "npapi.h"
58 #endif
60 #include "npruntime.h"
62 #include "jri.h"
65 /******************************************************************************************
66 plug-in function table macros
67 for each function in and out of the plugin API we define
68 typedef NPP_FooUPP
69 #define NewNPP_FooProc
70 #define CallNPP_FooProc
71 *******************************************************************************************/
74 /* NPP_Initialize */
75 typedef void (* NP_LOADDS NPP_InitializeUPP)(void);
76 #define NewNPP_InitializeProc(FUNC) \
77 ((NPP_InitializeUPP) (FUNC))
78 #define CallNPP_InitializeProc(FUNC) \
79 (*(FUNC))()
81 /* NPP_Shutdown */
82 typedef void (* NP_LOADDS NPP_ShutdownUPP)(void);
83 #define NewNPP_ShutdownProc(FUNC) \
84 ((NPP_ShutdownUPP) (FUNC))
85 #define CallNPP_ShutdownProc(FUNC) \
86 (*(FUNC))()
88 /* NPP_New */
89 typedef NPError (* NP_LOADDS NPP_NewUPP)(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
90 #define NewNPP_NewProc(FUNC) \
91 ((NPP_NewUPP) (FUNC))
92 #define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
93 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
95 /* NPP_Destroy */
96 typedef NPError (* NP_LOADDS NPP_DestroyUPP)(NPP instance, NPSavedData** save);
97 #define NewNPP_DestroyProc(FUNC) \
98 ((NPP_DestroyUPP) (FUNC))
99 #define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \
100 (*(FUNC))((ARG1), (ARG2))
102 /* NPP_SetWindow */
103 typedef NPError (* NP_LOADDS NPP_SetWindowUPP)(NPP instance, NPWindow* window);
104 #define NewNPP_SetWindowProc(FUNC) \
105 ((NPP_SetWindowUPP) (FUNC))
106 #define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \
107 (*(FUNC))((ARG1), (ARG2))
109 /* NPP_NewStream */
110 typedef NPError (* NP_LOADDS NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
111 #define NewNPP_NewStreamProc(FUNC) \
112 ((NPP_NewStreamUPP) (FUNC))
113 #define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
114 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
116 /* NPP_DestroyStream */
117 typedef NPError (* NP_LOADDS NPP_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
118 #define NewNPP_DestroyStreamProc(FUNC) \
119 ((NPP_DestroyStreamUPP) (FUNC))
120 #define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPReasonArg) \
121 (*(FUNC))((NPParg), (NPStreamPtr), (NPReasonArg))
123 /* NPP_WriteReady */
124 typedef int32 (* NP_LOADDS NPP_WriteReadyUPP)(NPP instance, NPStream* stream);
125 #define NewNPP_WriteReadyProc(FUNC) \
126 ((NPP_WriteReadyUPP) (FUNC))
127 #define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \
128 (*(FUNC))((NPParg), (NPStreamPtr))
130 /* NPP_Write */
131 typedef int32 (* NP_LOADDS NPP_WriteUPP)(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
132 #define NewNPP_WriteProc(FUNC) \
133 ((NPP_WriteUPP) (FUNC))
134 #define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \
135 (*(FUNC))((NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
137 /* NPP_StreamAsFile */
138 typedef void (* NP_LOADDS NPP_StreamAsFileUPP)(NPP instance, NPStream* stream, const char* fname);
139 #define NewNPP_StreamAsFileProc(FUNC) \
140 ((NPP_StreamAsFileUPP) (FUNC))
141 #define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \
142 (*(FUNC))((ARG1), (ARG2), (ARG3))
144 /* NPP_Print */
145 typedef void (* NP_LOADDS NPP_PrintUPP)(NPP instance, NPPrint* platformPrint);
146 #define NewNPP_PrintProc(FUNC) \
147 ((NPP_PrintUPP) (FUNC))
148 #define CallNPP_PrintProc(FUNC, NPParg, NPPrintArg) \
149 (*(FUNC))((NPParg), (NPPrintArg))
151 /* NPP_HandleEvent */
152 typedef int16 (* NP_LOADDS NPP_HandleEventUPP)(NPP instance, void* event);
153 #define NewNPP_HandleEventProc(FUNC) \
154 ((NPP_HandleEventUPP) (FUNC))
155 #define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \
156 (*(FUNC))((NPParg), (voidPtr))
158 /* NPP_URLNotify */
159 typedef void (* NP_LOADDS NPP_URLNotifyUPP)(NPP instance, const char* url, NPReason reason, void* notifyData);
160 #define NewNPP_URLNotifyProc(FUNC) \
161 ((NPP_URLNotifyUPP) (FUNC))
162 #define CallNPP_URLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
163 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
165 /* NPP_GetValue */
166 typedef NPError (* NP_LOADDS NPP_GetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
167 #define NewNPP_GetValueProc(FUNC) \
168 ((NPP_GetValueUPP) (FUNC))
169 #define CallNPP_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
170 (*(FUNC))((ARG1), (ARG2), (ARG3))
172 /* NPP_SetValue */
173 typedef NPError (* NP_LOADDS NPP_SetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
174 #define NewNPP_SetValueProc(FUNC) \
175 ((NPP_SetValueUPP) (FUNC))
176 #define CallNPP_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
177 (*(FUNC))((ARG1), (ARG2), (ARG3))
180 * Netscape entry points
184 /* NPN_GetValue */
185 typedef NPError (* NP_LOADDS NPN_GetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
186 #define NewNPN_GetValueProc(FUNC) \
187 ((NPN_GetValueUPP) (FUNC))
188 #define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
189 (*(FUNC))((ARG1), (ARG2), (ARG3))
191 /* NPN_SetValue */
192 typedef NPError (* NP_LOADDS NPN_SetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
193 #define NewNPN_SetValueProc(FUNC) \
194 ((NPN_SetValueUPP) (FUNC))
195 #define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
196 (*(FUNC))((ARG1), (ARG2), (ARG3))
198 /* NPN_GetUrlNotify */
199 typedef NPError (* NP_LOADDS NPN_GetURLNotifyUPP)(NPP instance, const char* url, const char* window, void* notifyData);
200 #define NewNPN_GetURLNotifyProc(FUNC) \
201 ((NPN_GetURLNotifyUPP) (FUNC))
202 #define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
203 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
205 /* NPN_PostUrlNotify */
206 typedef NPError (* NP_LOADDS NPN_PostURLNotifyUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData);
207 #define NewNPN_PostURLNotifyProc(FUNC) \
208 ((NPN_PostURLNotifyUPP) (FUNC))
209 #define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
210 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
212 /* NPN_GetUrl */
213 typedef NPError (* NP_LOADDS NPN_GetURLUPP)(NPP instance, const char* url, const char* window);
214 #define NewNPN_GetURLProc(FUNC) \
215 ((NPN_GetURLUPP) (FUNC))
216 #define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
217 (*(FUNC))((ARG1), (ARG2), (ARG3))
219 /* NPN_PostUrl */
220 typedef NPError (* NP_LOADDS NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file);
221 #define NewNPN_PostURLProc(FUNC) \
222 ((NPN_PostURLUPP) (FUNC))
223 #define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
224 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
226 /* NPN_RequestRead */
227 typedef NPError (* NP_LOADDS NPN_RequestReadUPP)(NPStream* stream, NPByteRange* rangeList);
228 #define NewNPN_RequestReadProc(FUNC) \
229 ((NPN_RequestReadUPP) (FUNC))
230 #define CallNPN_RequestReadProc(FUNC, stream, range) \
231 (*(FUNC))((stream), (range))
233 /* NPN_NewStream */
234 typedef NPError (* NP_LOADDS NPN_NewStreamUPP)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
235 #define NewNPN_NewStreamProc(FUNC) \
236 ((NPN_NewStreamUPP) (FUNC))
237 #define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \
238 (*(FUNC))((npp), (type), (window), (stream))
240 /* NPN_Write */
241 typedef int32 (* NP_LOADDS NPN_WriteUPP)(NPP instance, NPStream* stream, int32 len, void* buffer);
242 #define NewNPN_WriteProc(FUNC) \
243 ((NPN_WriteUPP) (FUNC))
244 #define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \
245 (*(FUNC))((npp), (stream), (len), (buffer))
247 /* NPN_DestroyStream */
248 typedef NPError (* NP_LOADDS NPN_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
249 #define NewNPN_DestroyStreamProc(FUNC) \
250 ((NPN_DestroyStreamUPP) (FUNC))
251 #define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \
252 (*(FUNC))((npp), (stream), (reason))
254 /* NPN_Status */
255 typedef void (* NP_LOADDS NPN_StatusUPP)(NPP instance, const char* message);
256 #define NewNPN_StatusProc(FUNC) \
257 ((NPN_StatusUPP) (FUNC))
258 #define CallNPN_StatusProc(FUNC, npp, msg) \
259 (*(FUNC))((npp), (msg))
261 /* NPN_UserAgent */
262 typedef const char* (* NP_LOADDS NPN_UserAgentUPP)(NPP instance);
263 #define NewNPN_UserAgentProc(FUNC) \
264 ((NPN_UserAgentUPP) (FUNC))
265 #define CallNPN_UserAgentProc(FUNC, ARG1) \
266 (*(FUNC))((ARG1))
268 /* NPN_MemAlloc */
269 typedef void* (* NP_LOADDS NPN_MemAllocUPP)(uint32 size);
270 #define NewNPN_MemAllocProc(FUNC) \
271 ((NPN_MemAllocUPP) (FUNC))
272 #define CallNPN_MemAllocProc(FUNC, ARG1) \
273 (*(FUNC))((ARG1))
275 /* NPN__MemFree */
276 typedef void (* NP_LOADDS NPN_MemFreeUPP)(void* ptr);
277 #define NewNPN_MemFreeProc(FUNC) \
278 ((NPN_MemFreeUPP) (FUNC))
279 #define CallNPN_MemFreeProc(FUNC, ARG1) \
280 (*(FUNC))((ARG1))
282 /* NPN_MemFlush */
283 typedef uint32 (* NP_LOADDS NPN_MemFlushUPP)(uint32 size);
284 #define NewNPN_MemFlushProc(FUNC) \
285 ((NPN_MemFlushUPP) (FUNC))
286 #define CallNPN_MemFlushProc(FUNC, ARG1) \
287 (*(FUNC))((ARG1))
289 /* NPN_ReloadPlugins */
290 typedef void (* NP_LOADDS NPN_ReloadPluginsUPP)(NPBool reloadPages);
291 #define NewNPN_ReloadPluginsProc(FUNC) \
292 ((NPN_ReloadPluginsUPP) (FUNC))
293 #define CallNPN_ReloadPluginsProc(FUNC, ARG1) \
294 (*(FUNC))((ARG1))
296 /* NPN_GetJavaEnv */
297 typedef JRIEnv* (* NP_LOADDS NPN_GetJavaEnvUPP)(void);
298 #define NewNPN_GetJavaEnvProc(FUNC) \
299 ((NPN_GetJavaEnvUPP) (FUNC))
300 #define CallNPN_GetJavaEnvProc(FUNC) \
301 (*(FUNC))()
303 /* NPN_GetJavaPeer */
304 typedef jref (* NP_LOADDS NPN_GetJavaPeerUPP)(NPP instance);
305 #define NewNPN_GetJavaPeerProc(FUNC) \
306 ((NPN_GetJavaPeerUPP) (FUNC))
307 #define CallNPN_GetJavaPeerProc(FUNC, ARG1) \
308 (*(FUNC))((ARG1))
310 /* NPN_InvalidateRect */
311 typedef void (* NP_LOADDS NPN_InvalidateRectUPP)(NPP instance, NPRect *rect);
312 #define NewNPN_InvalidateRectProc(FUNC) \
313 ((NPN_InvalidateRectUPP) (FUNC))
314 #define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2) \
315 (*(FUNC))((ARG1), (ARG2))
317 /* NPN_InvalidateRegion */
318 typedef void (* NP_LOADDS NPN_InvalidateRegionUPP)(NPP instance, NPRegion region);
319 #define NewNPN_InvalidateRegionProc(FUNC) \
320 ((NPN_InvalidateRegionUPP) (FUNC))
321 #define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2) \
322 (*(FUNC))((ARG1), (ARG2))
324 /* NPN_ForceRedraw */
325 typedef void (* NP_LOADDS NPN_ForceRedrawUPP)(NPP instance);
326 #define NewNPN_ForceRedrawProc(FUNC) \
327 ((NPN_ForceRedrawUPP) (FUNC))
328 #define CallNPN_ForceRedrawProc(FUNC, ARG1) \
329 (*(FUNC))((ARG1))
331 /* NPN_GetStringIdentifier */
332 typedef NPIdentifier (* NP_LOADDS NPN_GetStringIdentifierUPP)(const NPUTF8* name);
333 #define NewNPN_GetStringIdentifierProc(FUNC) \
334 ((NPN_GetStringIdentifierUPP) (FUNC))
335 #define CallNPN_GetStringIdentifierProc(FUNC, ARG1) \
336 (*(FUNC))((ARG1))
338 /* NPN_GetStringIdentifiers */
339 typedef void (* NP_LOADDS NPN_GetStringIdentifiersUPP)(const NPUTF8** names,
340 int32_t nameCount,
341 NPIdentifier* identifiers);
342 #define NewNPN_GetStringIdentifiersProc(FUNC) \
343 ((NPN_GetStringIdentifiersUPP) (FUNC))
344 #define CallNPN_GetStringIdentifiersProc(FUNC, ARG1, ARG2, ARG3) \
345 (*(FUNC))((ARG1), (ARG2), (ARG3))
347 /* NPN_GetIntIdentifier */
348 typedef NPIdentifier (* NP_LOADDS NPN_GetIntIdentifierUPP)(int32_t intid);
349 #define NewNPN_GetIntIdentifierProc(FUNC) \
350 ((NPN_GetIntIdentifierUPP) (FUNC))
351 #define CallNPN_GetIntIdentifierProc(FUNC, ARG1) \
352 (*(FUNC))((ARG1))
354 /* NPN_IdentifierIsString */
355 typedef bool (* NP_LOADDS NPN_IdentifierIsStringUPP)(NPIdentifier identifier);
356 #define NewNPN_IdentifierIsStringProc(FUNC) \
357 ((NPN_IdentifierIsStringUPP) (FUNC))
358 #define CallNPN_IdentifierIsStringProc(FUNC, ARG1) \
359 (*(FUNC))((ARG1))
361 /* NPN_UTF8FromIdentifier */
362 typedef NPUTF8* (* NP_LOADDS NPN_UTF8FromIdentifierUPP)(NPIdentifier identifier);
363 #define NewNPN_UTF8FromIdentifierProc(FUNC) \
364 ((NPN_UTF8FromIdentifierUPP) (FUNC))
365 #define CallNPN_UTF8FromIdentifierProc(FUNC, ARG1) \
366 (*(FUNC))((ARG1))
368 /* NPN_IntFromIdentifier */
369 typedef int32_t (* NP_LOADDS NPN_IntFromIdentifierUPP)(NPIdentifier identifier);
370 #define NewNPN_IntFromIdentifierProc(FUNC) \
371 ((NPN_IntFromIdentifierUPP) (FUNC))
372 #define CallNPN_IntFromIdentifierProc(FUNC, ARG1) \
373 (*(FUNC))((ARG1))
375 /* NPN_CreateObject */
376 typedef NPObject* (* NP_LOADDS NPN_CreateObjectUPP)(NPP npp, NPClass *aClass);
377 #define NewNPN_CreateObjectProc(FUNC) \
378 ((NPN_CreateObjectUPP) (FUNC))
379 #define CallNPN_CreateObjectProc(FUNC, ARG1, ARG2) \
380 (*(FUNC))((ARG1), (ARG2))
382 /* NPN_RetainObject */
383 typedef NPObject* (* NP_LOADDS NPN_RetainObjectUPP)(NPObject *obj);
384 #define NewNPN_RetainObjectProc(FUNC) \
385 ((NPN_RetainObjectUPP) (FUNC))
386 #define CallNPN_RetainObjectProc(FUNC, ARG1) \
387 (*(FUNC))((ARG1))
389 /* NPN_ReleaseObject */
390 typedef void (* NP_LOADDS NPN_ReleaseObjectUPP)(NPObject *obj);
391 #define NewNPN_ReleaseObjectProc(FUNC) \
392 ((NPN_ReleaseObjectUPP) (FUNC))
393 #define CallNPN_ReleaseObjectProc(FUNC, ARG1) \
394 (*(FUNC))((ARG1))
396 /* NPN_Invoke */
397 typedef bool (* NP_LOADDS NPN_InvokeUPP)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
398 #define NewNPN_InvokeProc(FUNC) \
399 ((NPN_InvokeUPP) (FUNC))
400 #define CallNPN_InvokeProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
401 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
403 /* NPN_InvokeDefault */
404 typedef bool (* NP_LOADDS NPN_InvokeDefaultUPP)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
405 #define NewNPN_InvokeDefaultProc(FUNC) \
406 ((NPN_InvokeDefaultUPP) (FUNC))
407 #define CallNPN_InvokeDefaultProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
408 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
410 /* NPN_Evaluate */
411 typedef bool (* NP_LOADDS NPN_EvaluateUPP)(NPP npp, NPObject *obj, NPString *script, NPVariant *result);
412 #define NewNPN_EvaluateProc(FUNC) \
413 ((NPN_EvaluateUPP) (FUNC))
414 #define CallNPN_EvaluateProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
415 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
417 /* NPN_GetProperty */
418 typedef bool (* NP_LOADDS NPN_GetPropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
419 #define NewNPN_GetPropertyProc(FUNC) \
420 ((NPN_GetPropertyUPP) (FUNC))
421 #define CallNPN_GetPropertyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
422 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
424 /* NPN_SetProperty */
425 typedef bool (* NP_LOADDS NPN_SetPropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
426 #define NewNPN_SetPropertyProc(FUNC) \
427 ((NPN_SetPropertyUPP) (FUNC))
428 #define CallNPN_SetPropertyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
429 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
431 /* NPN_RemoveProperty */
432 typedef bool (* NP_LOADDS NPN_RemovePropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName);
433 #define NewNPN_RemovePropertyProc(FUNC) \
434 ((NPN_RemovePropertyUPP) (FUNC))
435 #define CallNPN_RemovePropertyProc(FUNC, ARG1, ARG2, ARG3) \
436 (*(FUNC))((ARG1), (ARG2), (ARG3))
438 /* NPN_HasProperty */
439 typedef bool (* NP_LOADDS NPN_HasPropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName);
440 #define NewNPN_HasPropertyProc(FUNC) \
441 ((NPN_HasPropertyUPP) (FUNC))
442 #define CallNPN_HasPropertyProc(FUNC, ARG1, ARG2, ARG3) \
443 (*(FUNC))((ARG1), (ARG2), (ARG3))
445 /* NPN_HasMethod */
446 typedef bool (* NP_LOADDS NPN_HasMethodUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName);
447 #define NewNPN_HasMethodProc(FUNC) \
448 ((NPN_HasMethodUPP) (FUNC))
449 #define CallNPN_HasMethodProc(FUNC, ARG1, ARG2, ARG3) \
450 (*(FUNC))((ARG1), (ARG2), (ARG3))
452 /* NPN_ReleaseVariantValue */
453 typedef void (* NP_LOADDS NPN_ReleaseVariantValueUPP)(NPVariant *variant);
454 #define NewNPN_ReleaseVariantValueProc(FUNC) \
455 ((NPN_ReleaseVariantValueUPP) (FUNC))
456 #define CallNPN_ReleaseVariantValueProc(FUNC, ARG1) \
457 (*(FUNC))((ARG1))
459 /* NPN_SetException */
460 typedef void (* NP_LOADDS NPN_SetExceptionUPP)(NPObject *obj, const NPUTF8 *message);
461 #define NewNPN_SetExceptionProc(FUNC) \
462 ((NPN_SetExceptionUPP) (FUNC))
463 #define CallNPN_SetExceptionProc(FUNC, ARG1, ARG2) \
464 (*(FUNC))((ARG1), (ARG2))
466 /* NPN_PushPopupsEnabledStateUPP */
467 typedef bool (* NP_LOADDS NPN_PushPopupsEnabledStateUPP)(NPP npp, NPBool enabled);
468 #define NewNPN_PushPopupsEnabledStateProc(FUNC) \
469 ((NPN_PushPopupsEnabledStateUPP) (FUNC))
470 #define CallNPN_PushPopupsEnabledStateProc(FUNC, ARG1, ARG2) \
471 (*(FUNC))((ARG1), (ARG2))
473 /* NPN_PopPopupsEnabledState */
474 typedef bool (* NP_LOADDS NPN_PopPopupsEnabledStateUPP)(NPP npp);
475 #define NewNPN_PopPopupsEnabledStateProc(FUNC) \
476 ((NPN_PopPopupsEnabledStateUPP) (FUNC))
477 #define CallNPN_PopPopupsEnabledStateProc(FUNC, ARG1) \
478 (*(FUNC))((ARG1))
480 /* NPN_Enumerate */
481 typedef bool (* NP_LOADDS NPN_EnumerateUPP)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count);
482 #define NewNPN_EnumerateProc(FUNC) \
483 ((NPN_EnumerateUPP) (FUNC))
484 #define CallNPN_EnumerateProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
485 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
487 /* NPN_PluginThreadAsyncCall */
488 typedef void (* NP_LOADDS NPN_PluginThreadAsyncCallUPP)(NPP instance, void (*func)(void *), void *userData);
489 #define NewNPN_PluginThreadAsyncCallProc(FUNC) \
490 ((NPN_PluginThreadAsyncCallUPP) (FUNC))
491 #define CallNPN_PluginThreadAsyncCallProc(FUNC, ARG1, ARG2, ARG3) \
492 (*(FUNC))((ARG1), (ARG2), (ARG3))
494 /* NPN_Construct */
495 typedef bool (* NP_LOADDS NPN_ConstructUPP)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
496 #define NewNPN_ConstructProc(FUNC) \
497 ((NPN_ConstructUPP) (FUNC))
498 #define CallNPN_ConstructProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
499 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
503 /******************************************************************************************
504 * The actual plugin function table definitions
505 *******************************************************************************************/
507 typedef struct _NPPluginFuncs {
508 uint16 size;
509 uint16 version;
510 NPP_NewUPP newp;
511 NPP_DestroyUPP destroy;
512 NPP_SetWindowUPP setwindow;
513 NPP_NewStreamUPP newstream;
514 NPP_DestroyStreamUPP destroystream;
515 NPP_StreamAsFileUPP asfile;
516 NPP_WriteReadyUPP writeready;
517 NPP_WriteUPP write;
518 NPP_PrintUPP print;
519 NPP_HandleEventUPP event;
520 NPP_URLNotifyUPP urlnotify;
521 JRIGlobalRef javaClass;
522 NPP_GetValueUPP getvalue;
523 NPP_SetValueUPP setvalue;
524 } NPPluginFuncs;
526 typedef struct _NPNetscapeFuncs {
527 uint16 size;
528 uint16 version;
529 NPN_GetURLUPP geturl;
530 NPN_PostURLUPP posturl;
531 NPN_RequestReadUPP requestread;
532 NPN_NewStreamUPP newstream;
533 NPN_WriteUPP write;
534 NPN_DestroyStreamUPP destroystream;
535 NPN_StatusUPP status;
536 NPN_UserAgentUPP uagent;
537 NPN_MemAllocUPP memalloc;
538 NPN_MemFreeUPP memfree;
539 NPN_MemFlushUPP memflush;
540 NPN_ReloadPluginsUPP reloadplugins;
541 NPN_GetJavaEnvUPP getJavaEnv;
542 NPN_GetJavaPeerUPP getJavaPeer;
543 NPN_GetURLNotifyUPP geturlnotify;
544 NPN_PostURLNotifyUPP posturlnotify;
545 NPN_GetValueUPP getvalue;
546 NPN_SetValueUPP setvalue;
547 NPN_InvalidateRectUPP invalidaterect;
548 NPN_InvalidateRegionUPP invalidateregion;
549 NPN_ForceRedrawUPP forceredraw;
550 NPN_GetStringIdentifierUPP getstringidentifier;
551 NPN_GetStringIdentifiersUPP getstringidentifiers;
552 NPN_GetIntIdentifierUPP getintidentifier;
553 NPN_IdentifierIsStringUPP identifierisstring;
554 NPN_UTF8FromIdentifierUPP utf8fromidentifier;
555 NPN_IntFromIdentifierUPP intfromidentifier;
556 NPN_CreateObjectUPP createobject;
557 NPN_RetainObjectUPP retainobject;
558 NPN_ReleaseObjectUPP releaseobject;
559 NPN_InvokeUPP invoke;
560 NPN_InvokeDefaultUPP invokeDefault;
561 NPN_EvaluateUPP evaluate;
562 NPN_GetPropertyUPP getproperty;
563 NPN_SetPropertyUPP setproperty;
564 NPN_RemovePropertyUPP removeproperty;
565 NPN_HasPropertyUPP hasproperty;
566 NPN_HasMethodUPP hasmethod;
567 NPN_ReleaseVariantValueUPP releasevariantvalue;
568 NPN_SetExceptionUPP setexception;
569 NPN_PushPopupsEnabledStateUPP pushpopupsenabledstate;
570 NPN_PopPopupsEnabledStateUPP poppopupsenabledstate;
571 NPN_EnumerateUPP enumerate;
572 NPN_PluginThreadAsyncCallUPP pluginthreadasynccall;
573 NPN_ConstructUPP construct;
574 } NPNetscapeFuncs;
577 #ifdef XP_MACOSX
578 /******************************************************************************************
579 * Mac platform-specific plugin glue stuff
580 *******************************************************************************************/
583 * Main entry point of the plugin.
584 * This routine will be called when the plugin is loaded. The function
585 * tables are passed in and the plugin fills in the NPPluginFuncs table
586 * and NPPShutdownUPP for Netscape's use.
588 typedef NPError (* NP_LOADDS NPP_MainEntryUPP)(NPNetscapeFuncs*, NPPluginFuncs*, NPP_ShutdownUPP*);
589 #define NewNPP_MainEntryProc(FUNC) \
590 ((NPP_MainEntryUPP) (FUNC))
591 #define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \
592 (*(FUNC))((netscapeFunc), (pluginFunc), (shutdownUPP))
595 * Mac OS X version(s) of NP_GetMIMEDescription(const char *)
596 * These can be called to retreive MIME information from the plugin dynamically
598 * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
599 * to get mime info from the plugin only on OSX and may not be supported
600 * in furture version -- use NP_GetMIMEDescription instead
603 enum
605 kBPSupportedMIMETypesStructVers_1 = 1
608 typedef struct _BPSupportedMIMETypes
610 SInt32 structVersion; /* struct version */
611 Handle typeStrings; /* STR# formated handle, allocated by plug-in */
612 Handle infoStrings; /* STR# formated handle, allocated by plug-in */
613 } BPSupportedMIMETypes;
614 OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
616 /* NP_GetMIMEDescription */
617 #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
618 typedef const char* (* NP_LOADDS NP_GetMIMEDescriptionUPP)();
619 #define NewNP_GetMIMEDescEntryProc(FUNC) \
620 ((NP_GetMIMEDescriptionUPP) (FUNC))
621 #define CallNP_GetMIMEDescEntryProc(FUNC) \
622 (*(FUNC))()
624 /* BP_GetSupportedMIMETypes */
625 typedef OSErr (* NP_LOADDS BP_GetSupportedMIMETypesUPP)(BPSupportedMIMETypes*, UInt32);
626 #define NewBP_GetSupportedMIMETypesEntryProc(FUNC) \
627 ((BP_GetSupportedMIMETypesUPP) (FUNC))
628 #define CallBP_GetMIMEDescEntryProc(FUNC, mimeInfo, flags) \
629 (*(FUNC))((mimeInfo), (flags))
631 #endif /* XP_MACOSX */
633 #if defined(_WINDOWS)
634 #define OSCALL WINAPI
635 #else
636 #if defined(__OS2__)
637 #define OSCALL _System
638 #else
639 #define OSCALL
640 #endif
641 #endif
643 #if defined(XP_UNIX)
644 /* GCC 3.3 and later support the visibility attribute. */
645 #if defined(__GNUC__) && \
646 ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
647 #define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
648 #else
649 #define NP_VISIBILITY_DEFAULT
650 #endif
652 #define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
653 #endif
655 #if defined( _WINDOWS ) || defined (__OS2__)
657 #ifdef __cplusplus
658 extern "C" {
659 #endif
661 /* plugin meta member functions */
662 #if defined(__OS2__)
664 typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */
665 char *pMimeTypes;
666 char *pFileExtents;
667 char *pFileOpenTemplate;
668 char *pProductName;
669 char *pProductDescription;
670 unsigned long dwProductVersionMS;
671 unsigned long dwProductVersionLS;
672 } NPPluginData;
674 NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData);
676 #endif
678 NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
680 NPError OSCALL NP_Initialize(NPNetscapeFuncs* pFuncs);
682 NPError OSCALL NP_Shutdown();
684 char* NP_GetMIMEDescription();
686 #ifdef __cplusplus
688 #endif
690 #endif /* _WINDOWS || __OS2__ */
692 #if defined(__OS2__)
693 #pragma pack()
694 #endif
696 #ifdef XP_UNIX
698 #ifdef __cplusplus
699 extern "C" {
700 #endif
702 /* plugin meta member functions */
704 NP_EXPORT(char*) NP_GetMIMEDescription(void);
705 NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs*, NPPluginFuncs*);
706 NP_EXPORT(NPError) NP_Shutdown(void);
707 NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue);
709 #ifdef __cplusplus
711 #endif
713 #endif /* XP_UNIX */
715 #endif /* _NPUPP_H_ */